<%-- 
    Document   : MergeBody
    Created on : 28/04/2011, 05:12:53 م
    Author     : Mostafa
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib  prefix="html" uri="http://struts.apache.org/tags-html" %>
<%@taglib  prefix="logic" uri="http://struts.apache.org/tags-logic" %>
<%@taglib  prefix="bean" uri="/WEB-INF/struts-bean.tld" %>
<!DOCTYPE html>


<script type="text/javascript">
	tinyMCE.init({
		// General options
		mode : "exact",
		elements : "myt2",
		theme : "advanced",
		skin : "o2k7",
		skin_variant : "black",
		plugins : "lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave",

		// Theme options
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,

		// Example content CSS (should be your site CSS)
		content_css : "css/content.css",

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "te/lists/template_list.js",
		external_link_list_url : "te/lists/link_list.js",
		external_image_list_url : "te/lists/image_list.js",
		media_external_list_url : "te/lists/media_list.js",

		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	});
</script>

<div id="page-body"> 
 
    <html:form onsubmit="return selectall()" action="splitaction.do" >
    
        
        <table border="1">
     
            <tr>  
                <td style="width: 300">  
       
                    <h4 style="color: white" > Old Thread Title </h4><br><br>
                    <h4><html:hidden property="oldthreadid"/> <html:text property="oldtitle"/></h4>   <br> <br>
                
                </td>
                <td style="width: 300" ></td>
                <td>
                    
                     <h4 style="color: white" > New Thread Title </h4> <br><br>
                     <h4> <html:text property="newtitle"/>  </h4>  <br> <br> 
                    
                </td>
            </tr>
            
            
            
            
                 <tr>  
                <td style="width: 300">  
       
                    <h4 style="color: white" > Old Thread Description </h4><br><br>
                    <h4> <html:text property="olddescription"/></h4>   <br> <br>
                
                </td>
                <td style="width: 300" ></td>
                <td>
                    
                     <h4 style="color: white" > New Thread Description </h4> <br><br>
                     <h4> <html:text property="newdescription"/>  </h4>  <br> <br> 
                    
                </td>
            </tr>
            
            
            <tr>
                  <td style="width: 300">  
                    
                    <h4 style="color: white" > Old Thread Body </h4><br><br>
                      <h4> <input type="button" value="Insert Code Block" id="codeblock" onclick="makecode()" /></h4>
                     <html:textarea styleId="myt"  property="oldthreadbody"/> <br> <br>
                
                </td>
                <td></td>
                  <td>
                    
                     <h4 style="color: white" > New Thread Body </h4> <br><br>
                    <h4> <input type="button" value="Insert Code Block" id="codeblock" onclick="makecode2()" /></h4>
                    <html:textarea styleId="myt2" property="newthreadbody"/>    <br> <br> 
                    
                </td>
            </tr>
            
            <tr>
                
                <td>
                    <h4>Old Posts </h4>
                     <html:select property="oldpostsid" multiple="true" styleId="s1" >
                     <logic:iterate name="SplitActionForm" id="bn" property="oldthread.posts"  >
    
    
    <html:option    value="${bn.postId}" >
                 <bean:write name="bn" property="title"/> 
    </html:option>

   
</logic:iterate>
</html:select>
                    
                </td>
                
                <td> <font size="4"><input type="button" value=">>" onclick="moveRight()" />
		<input type="button" value="<<" onclick="moveLeft()" /><font size="5">
		</td>
                
                <td>
                    <h4>New Posts</h4>
                    <html:select property="newpostsid" multiple="true" styleId="s2" >
                    </html:select>
                    
                </td>
            </tr>
            
            
            
            
        </table>
       
                     <br><br><br>
 <h1> &nbsp;&nbsp;&nbsp; <html:submit property="method" value="Execute_Split"/></h1>   
 <br><br><br>  		
		
        
    
    
    
    
</html:form>

    
    
    <script type="text/javascript">
        
        function selectall() {
            
         //   alert('load');
           var  selectBox = document.getElementById("s1");
    
  // alert(selectBox.options.length);

    // is the select box a multiple select box?
        for (var i = 0; i < selectBox.options.length; i++) {
        //   alert(selectBox.options.length);
           selectBox.options[i].selected = true;
            
        }
    
    
          selectBox = document.getElementById("s2");
    
  // alert(selectBox.options.length);

    // is the select box a multiple select box?
        for (var i = 0; i < selectBox.options.length; i++) {
        //   alert(selectBox.options.length);
           selectBox.options[i].selected = true;
            
        }
    
    
        }
        
        	function moveRight()
		{
			//alert('move');
			var s1=document.getElementById("s1");
			var s2=document.getElementById("s2");
		    for (var i = 0; i< s1.length; i++){
	
					if(s1.options[i].selected)
					{
						var newOption=new Option( s1.options[i].text,s1.options[i].value);
						s2.options[s2.options.length]=newOption;
						s1.options[i]=null;
						
					}
	
              };
		}
		
			function moveLeft()
		{
			var s1=document.getElementById("s1");
			var s2=document.getElementById("s2");
		    for (var i = 0; i< s2.length; i++){
	
					if(s2.options[i].selected)
					{
						var newOption=new Option( s2.options[i].text,s2.options[i].value);
						s1.options[s1.options.length]=newOption;
						s2.options[i]=null;
						
					}
	
              };
		}
		
       
    </script>
    
    </div>